  @include('public.page_styles')
  <link rel="stylesheet" href="{{ asset("/AdminLTE/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css") }}">
</head>


<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
  @include('public.top')
  <!-- Left side column. contains the logo and sidebar -->
  @include('public.sidebar')
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
          {{ trans('message.activity') }}
        <small>{{ trans('message.list') }}</small>
      </h1>
      <ol class="breadcrumb">
        <li><a ><i class="fa fa-dashboard"></i> {{ trans('message.home') }}</a></li>
        <li><a >{{ trans('message.serviceManage') }}</a></li>
        <li class="active"> {{ trans('message.activity') }}{{ trans('message.manage') }}</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title"></h3>
                @if(in_array(getOptionId('新增'),$optionArr))
                    <a href="{{ url('activity/create') }}" class="btn btn-sm btn-success">
                        <i class="fa fa-save"></i>&nbsp;&nbsp;{{ trans('message.add') }}
                    </a>
                @endif
              <div class="pull-right">
                <div class="btn-group pull-right" style="margin-right: 10px">
                    <span>
                        <a href="javascript:void(0);"class="btn btn-sm btn-primary grid-refresh" onclick="refresh()"><i class="fa fa-refresh"></i> {{ trans('message.refresh') }} </a>
                    </span>
                </div>
              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                  <tr>
                    <th>ID</th>
                    <th>活动名称</th>
                    <th>描述</th>
                    <th>发布者</th>
                    {{--<th>活动时间</th>--}}
                    <th>发布时间</th>
                    <th>状态</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                @if($activitys)
                  @foreach($activitys as $activity)
                    <tr>
                      <td>{{ $activity->id }}</td>
                      <td>{{ $activity->activity_name }}</td>
                      <td>{{ $activity->activity_dec }}</td>
                      <td>{{ $activity->author }}</td>
                      <td>{{ $activity->created_at }}</td>
                      <td>{{state_config('user_coupon',$activity->state) }}</td>
                      <td>
                          @if(in_array(getOptionId('查看详情'),$optionArr))
                              <a href="{{ url('activity/info/'.$activity->id) }}"><i class="fa fa-eye"></i></a>
                          @endif
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                          @if(in_array(getOptionId('编辑'),$optionArr))
                              {{--活动未开始，可以编辑　--}}
                              @if($activity->state == 1)
                                  <a href="{{ url('activity/edit') }}/{{ $activity->id }}"><i class="fa fa-edit"></i></a>　
                              @endif
                          @endif

                          @if(in_array(getOptionId('删除'),$optionArr))
                              {{--活动已过期，可以删除--}}
                              @if($activity->state == 3)
                                  <a  href="javascript:void(0);" data-id="{{ $activity->id }}" class="u_del"><i class="fa fa-trash"></i></a>
                              @endif
                          @endif

                      </td>
                    </tr>
                  @endforeach
                @endif
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
  <!-- /.content-wrapper -->
  @include('public.bottom')

  <!-- Control Sidebar -->
  {{--@include('public.aside')--}}
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->
@include('public.javascript')
<script src="{{ asset ("/AdminLTE/bower_components/datatables.net/js/jquery.dataTables.min.js") }}" type="text/javascript"></script>
<script src="{{ asset ("/AdminLTE/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js") }}" type="text/javascript"></script>
<script src="{{ asset ("/AdminLTE/bower_components/jquery-slimscroll/jquery.slimscroll.min.js") }}" type="text/javascript"></script>
{{--<script src="{{ asset ("/AdminLTE/bower_components/fastclick/lib/fastclick.js") }}" type="text/javascript"></script>--}}
<script src="{{ asset ("/js/bootbox.js") }}" type="text/javascript"></script>

<!-- page script -->
<script>
  $(function(){
      $('#example1').dataTable({
          "language": {
              "url":"{{ asset ("/AdminLTE/bower_components/datatables.net/chinese.json") }}"
          },
          "aaSorting": [[ 0, "desc" ]],//默认第几个排序
          "bStateSave": true,//状态保存
          "aoColumnDefs": [
              //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
              {"orderable":false,"aTargets":[1,2,3,4,5,6]}// 制定列不参与排序
          ]
      });


      bootbox.setDefaults({
          locale: "zh_CN",
      });

      @if(session()->has('success'))
              alertMess("{{session()->get('success')}}");
      @endif



      $('.u_del').click(function(e){
        var id=$(this).data('id');
          bootbox.confirm('确定要删除吗？', function(result) {
                  if(result){
                      $.ajax({
                          url: '{{url('activity/list/del')}}',
                          type: 'get',
                          data : {
                              id : id
                          },
                          success: function (response) {
                              console.log(response);
                              if (response == 1) {
                                  alertMess("删除成功");
                              }else{
                                  alertMess("删除失败");
                              }
                          },
                          error : function (result) {

                          }
                      });
                  }
          });
    });




  });

</script>
</body>
</html>
